<template>
    <div>
        <ul class="mui-table-view">
				<li class="mui-table-view-cell mui-media" v-for="item in news" :key="item.id">
					<router-link :to="'/home/newInfo/' + item.id">
						<img class="mui-media-object mui-pull-left" :src="item.img_url">
						<div class="mui-media-body">
							<h4>{{item.title}}</h4>
							<p class="mui-ellipsis">
                                <span>时间：{{item.add_time | dateFormat}}</span>
                                <span>点击：{{item.click}}</span>
                            </p>
						</div>
					</router-link>
				</li>
			</ul>
    </div>
</template>

<script>
import { Toast } from "mint-ui";
export default {
   data() {
       return {
           news:[]
       }
   },
   created() {
        this.getNewList()
   },
   methods: {
        getNewList(){
            this.$http('http://www.liulongbin.top:3005/api/getnewslist')
            .then(res => {
                if (res.data.status == 0) {
                    this.news = res.data.message;
                    console.log(res.data.message);
                    
                }
        })
        .catch(function(error) {
          // handle error
           Toast("获取新闻列表失败");
        });
    }
   },
}
</script>
<style lang="less" scoped>
    .mui-table-view{
        h4{
            font-size: 14px
        }

        .mui-ellipsis{
            color:#26a2ff;
            font-size: 12px;
            display: flex;
            justify-content: space-between
        }
    }

</style>